#!/bin/bash

dbserver=192.168.117.100
port=3306
user=root
pass=123456
dbname=db2_filterd
tbname=t_filterd

usage()
{
	echo "usage:  $1 <file> <level>"
	exit -1
}

if [ $# -ne 2 ]  ; then
	usage import.sh
fi

flag=1
level=$2
cat $1|while  read param;
do
	word=${param%%|*}
	type=${param##*|}
	/usr/local/mysql/bin/mysql -h $dbserver -P $port -u $user -p$pass  -e "set names gbk;insert into $dbname.$tbname (type,word,level) values  ($type,\"$word\",$level);"
	#echo "\"$word\""
	#echo $type
done
